﻿@echo off

::获取管理员权限方法一：
%1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1)(window.close)&&exit
::保持当前目录下运行:
cd /d "%~dp0"

::后面是jdk安装路径，更改成自己的jdk安装路径
setx /M JAVA_HOME "C:\Program Files\Java\jdk1.8.0_241"
setx /M CLASSPATH ".;%%JAVA_HOME%%\lib\dt.jar;%%JAVA_HOME%%\lib\tools.jar"
setx /M PATH "%PATH%;%%JAVA_HOME%%\bin;%%JAVA_HOME%%\jre\bin"

echo 设置成功

java -version
pause